package com.itboye.mybatis.enumtype;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

/**
 * CodeType.java
 * Created on  2016/7/29 10:40
 * 版本       修改时间          作者      修改内容
 * V1.0.1    2016/7/29      hebidu    初始版本
 * <p>
 * Copyright (c) 2013 杭州博也网络科技有限公司 版权所有
 * HANGZHOU BOYE TECHNOLOGY CO.,LTD. All Rights Reserved.
 */
@JsonSerialize(using = CodeTypeSerializer.class)
public enum  CodeType {

    REGISTER(1,"注册"),
    UPDATE_PASSWORD(2,"更新密码"),
    NEW_BIND_PHONE(3,"新绑定手机"),
    /**
     * 4  更换绑定手机
     */
    CHANGE_PHONE(4,"更换绑定手机"),
    LOGIN(5,"登录"),
    BIND_ALIPAY_ACCOUNT(6,"绑定支付宝");

    public static CodeType getCodeType(int codeTypeValue){

        for ( CodeType codeType : CodeType.values() ) {
            if(codeType.getValue() == codeTypeValue){
                return codeType;
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return "CodeType{" +
                "value=" + value +
                ", desc='" + desc + '\'' +
                '}';
    }

    private int value;
    private String desc;

    CodeType(int value,String desc){
        this.value = value;
        this.desc = desc;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
